﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Freejobber.Core.Generic
{
    public class FileSystemAvatarManager:IAvatarManager
    {
        string avatarsPath = "C:\\Develop\\codeplex\\freelance\\Freelance\\Images\\Avatars\\";
        string avatarUrl = "http://localhost:6547/images/avatars/";
        public string GetAvatarUrl(string login)
        {
            string _url = string.Empty;
            _url = string.Format("{0}{1}", avatarUrl, login);
            throw new NotImplementedException();
        }

        public bool SaveAvatar(string login, byte[] data)
        {
            bool _result = true;
            try
            {
                File.WriteAllBytes(string.Format("{0}{1}.jpg", avatarsPath, login), data);
            }
            catch (Exception ex)
            {
                _result = false;
            }
            return _result;
        }

        public void GetAvatar(string login)
        {
            throw new NotImplementedException();
        }
    }
}
